<?php

if (strpos(' ' . $_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false) {
$miniBB_gzipper_encoding = 'x-gzip';
}
if (strpos(' ' . $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false) {
$miniBB_gzipper_encoding = 'gzip';
}
if (isset($miniBB_gzipper_encoding)) {
ob_start();
}
function percent($a, $b) {
$c = $b/$a*100;
return $c;
}



//подключаем функции и настройки, коннектимся к базе
require $_SERVER['DOCUMENT_ROOT']."/core/init_base.php";

//разбиваем запрошенный УРЛ на части
$ThisPage=$_SERVER['REQUEST_URI'];

$url=$_SERVER['REQUEST_URI'];
$url=explode("/",$url);
$url=Clear_array($url);

unset($url[0]);

session_start();

//тестирование входящих данных
/*echo "<pre>";
print_r($url);
echo "</pre>";
*/


//подключаем дизайн сайта и модули
require "modules/core/index.php";

//print_r($_SERVER);


//if ($_SERVER['REMOTE_ADDR']!="93.185.201.14") 
//$web_optimizer->finish();
//echo('<!- GZipper_Stats ->');

if (isset($miniBB_gzipper_encoding)) {
$miniBB_gzipper_in = ob_get_contents();
$miniBB_gzipper_inlenn = strlen($miniBB_gzipper_in);
$miniBB_gzipper_out = gzencode($miniBB_gzipper_in, 2);
$miniBB_gzipper_lenn = strlen($miniBB_gzipper_out);
$miniBB_gzipper_in_strlen = strlen($miniBB_gzipper_in);
$gzpercent = percent($miniBB_gzipper_in_strlen, $miniBB_gzipper_lenn);
$percent = round($gzpercent);
$miniBB_gzipper_in = str_replace('<!- GZipper_Stats ->', 'Original size: '.strlen($miniBB_gzipper_in).' GZipped size: '.$miniBB_gzipper_lenn.' Сompression: '.$percent.'%<hr>', $miniBB_gzipper_in);
$miniBB_gzipper_out = gzencode($miniBB_gzipper_in, 2);
ob_clean();
header('Content-Encoding: '.$miniBB_gzipper_encoding);
echo $miniBB_gzipper_out;
}

?>

